package com.qf.controller;

import com.qf.pojo.ComplaintsForm;
import com.qf.pojo.resp.BaseResult;
import com.qf.service.ComplaintsFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ComplaintsForm")
@CrossOrigin
public class ComplaintsFormController {

    @Autowired
    ComplaintsFormService complaintsFormService;

    @RequestMapping("/findAll")
    public BaseResult findAllComplaints(){
        BaseResult result = complaintsFormService.findAllComplaints();
        return result;
    }

    @RequestMapping("/addOne")
    public BaseResult addOne(@RequestBody  ComplaintsForm complaints){
        System.out.println(complaints);
        BaseResult result = complaintsFormService.addOne(complaints);
        return result;
    }
}
